Add option to Garmin to set GPS time to computer's time. (For broken Vista GPS...)
authorrobertl <robertl>
Sun, 20 Jan 2008 23:42:32 +0000 (23:42 +0000)
committerrobertl <robertl>
Sun, 20 Jan 2008 23:42:32 +0000 (23:42 +0000)
garmin.c

index 4f4ac84db16853dfe88c0f9179bd475aea29232e..b9cb2cd5763a66c7bd7be71d6cd56a684c9f1b96 100644 (file)
--- a/garmin.c
+++ b/garmin.c
@@ -37,6 +37,7 @@ static GPS_PTrack *tx_tracklist;
 static GPS_PTrack *cur_tx_tracklist_entry;
 static char *getposn = NULL;
 static char *poweroff = NULL;
+static char *resettime = NULL;
 static char *snlen = NULL;
 static char *snwhiteopt = NULL;
 static char *deficon = NULL;
@@ -58,6 +59,8 @@ arglist_t garmin_args[] = {
                NULL, ARGTYPE_BOOL, ARG_NOMINMAX},
        { "power_off", &poweroff, "Command unit to power itself down", 
                NULL, ARGTYPE_BOOL, ARG_NOMINMAX},
+       { "resettime", &resettime, "Sync GPS time to computer time", 
+               NULL, ARGTYPE_BOOL, ARG_NOMINMAX},
        { "category", &category, "Category number to use for written waypoints", 
                NULL, ARGTYPE_INT, "1", "16"},
        ARG_TERMINATOR
@@ -90,6 +93,16 @@ rw_init(const char *fname)
                return;
        }
 
+       /*
+        * THis is Gross. The B&W Vista sometimes sets its time decades into
+        * the future with no way to reset it.  This apparently can "cure"
+        * an affected unit.
+        */
+       if (resettime) {
+               GPS_Command_Send_Time(fname, current_time());
+               return;
+       }
+
         if (GPS_Init(fname) < 0) {
                fatal(MYNAME ":Can't init %s\n", fname);
        }